
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml" lang="zh_CN">
  <head>
    <meta charset="utf-8" />
    <title>Python 语言服务 &#8212; Python 3.7.8 文档</title>
    <link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    <script type="text/javascript" src="../_static/translations.js"></script>
    
    <script type="text/javascript" src="../_static/sidebar.js"></script>
    
    <link rel="search" type="application/opensearchdescription+xml"
          title="在 Python 3.7.8 文档 中搜索"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="关于这些文档" href="../about.html" />
    <link rel="index" title="索引" href="../genindex.html" />
    <link rel="search" title="搜索" href="../search.html" />
    <link rel="copyright" title="版权所有" href="../copyright.html" />
    <link rel="next" title="parser --- 访问 Python 解析树" href="parser.html" />
    <link rel="prev" title="importlib --- import 的实现" href="importlib.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
    <link rel="canonical" href="https://docs.python.org/3/library/language.html" />
    
    <script type="text/javascript" src="../_static/copybutton.js"></script>
    
    
    
    
    <style>
      @media only screen {
        table.full-width-table {
            width: 100%;
        }
      }
    </style>
 

  </head><body>
  
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>导航</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="总目录"
             accesskey="I">索引</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python 模块索引"
             >模块</a> |</li>
        <li class="right" >
          <a href="parser.html" title="parser --- 访问 Python 解析树"
             accesskey="N">下一页</a> |</li>
        <li class="right" >
          <a href="importlib.html" title="importlib --- import 的实现"
             accesskey="P">上一页</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &#187;</li>
        <li>
          <a href="../index.html">3.7.8 Documentation</a> &#187;
        </li>

          <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Python 标准库</a> &#187;</li>
    <li class="right">
        

    <div class="inline-search" style="display: none" role="search">
        <form class="inline-search" action="../search.html" method="get">
          <input placeholder="快速搜索" type="text" name="q" />
          <input type="submit" value="转向" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
    <script type="text/javascript">$('.inline-search').show(0);</script>
         |
    </li>

      </ul>
    </div>    

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="python-language-services">
<span id="language"></span><h1>Python 语言服务<a class="headerlink" href="#python-language-services" title="永久链接至标题">¶</a></h1>
<p>Python 提供了许多模块来帮助使用 Python 语言。 这些模块支持标记化、解析、语法分析、字节码反汇编以及各种其他工具。</p>
<p>这些模块包括：</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="parser.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">parser</span></code> --- 访问 Python 解析树</a><ul>
<li class="toctree-l2"><a class="reference internal" href="parser.html#creating-st-objects">创建 ST 对象</a></li>
<li class="toctree-l2"><a class="reference internal" href="parser.html#converting-st-objects">转换 ST 对象</a></li>
<li class="toctree-l2"><a class="reference internal" href="parser.html#queries-on-st-objects">Queries on ST Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="parser.html#exceptions-and-error-handling">异常和错误处理</a></li>
<li class="toctree-l2"><a class="reference internal" href="parser.html#st-objects">ST 对象</a></li>
<li class="toctree-l2"><a class="reference internal" href="parser.html#example-emulation-of-compile">示例: <code class="xref py py-func docutils literal notranslate"><span class="pre">compile()</span></code> 的模拟</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="ast.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">ast</span></code> --- 抽象语法树</a><ul>
<li class="toctree-l2"><a class="reference internal" href="ast.html#node-classes">节点类</a></li>
<li class="toctree-l2"><a class="reference internal" href="ast.html#abstract-grammar">抽象文法</a></li>
<li class="toctree-l2"><a class="reference internal" href="ast.html#ast-helpers"><code class="xref py py-mod docutils literal notranslate"><span class="pre">ast</span></code> 中的辅助函数</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="symtable.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">symtable</span></code> --- Access to the compiler's symbol tables</a><ul>
<li class="toctree-l2"><a class="reference internal" href="symtable.html#generating-symbol-tables">Generating Symbol Tables</a></li>
<li class="toctree-l2"><a class="reference internal" href="symtable.html#examining-symbol-tables">Examining Symbol Tables</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="symbol.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">symbol</span></code> --- 与 Python 解析树一起使用的常量</a></li>
<li class="toctree-l1"><a class="reference internal" href="token.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">token</span></code> --- 与Python解析树一起使用的常量</a></li>
<li class="toctree-l1"><a class="reference internal" href="keyword.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">keyword</span></code> --- 检验Python关键字</a></li>
<li class="toctree-l1"><a class="reference internal" href="tokenize.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">tokenize</span></code> -- 对 Python 代码使用的标记解析器</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tokenize.html#tokenizing-input">对输入进行解析标记</a></li>
<li class="toctree-l2"><a class="reference internal" href="tokenize.html#command-line-usage">Command-Line Usage</a></li>
<li class="toctree-l2"><a class="reference internal" href="tokenize.html#examples">例子</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="tabnanny.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">tabnanny</span></code> --- 模糊缩进检测</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyclbr.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pyclbr</span></code> --- Python module browser support</a><ul>
<li class="toctree-l2"><a class="reference internal" href="pyclbr.html#function-objects">函数对象</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyclbr.html#class-objects">类对象</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="py_compile.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">py_compile</span></code> --- Compile Python source files</a></li>
<li class="toctree-l1"><a class="reference internal" href="compileall.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">compileall</span></code> --- Byte-compile Python libraries</a><ul>
<li class="toctree-l2"><a class="reference internal" href="compileall.html#command-line-use">Command-line use</a></li>
<li class="toctree-l2"><a class="reference internal" href="compileall.html#public-functions">Public functions</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="dis.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">dis</span></code> --- Python 字节码反汇编器</a><ul>
<li class="toctree-l2"><a class="reference internal" href="dis.html#bytecode-analysis">字节码分析</a></li>
<li class="toctree-l2"><a class="reference internal" href="dis.html#analysis-functions">分析函数</a></li>
<li class="toctree-l2"><a class="reference internal" href="dis.html#python-bytecode-instructions">Python字节码说明</a></li>
<li class="toctree-l2"><a class="reference internal" href="dis.html#opcode-collections">操作码集合</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="pickletools.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pickletools</span></code> --- pickle 开发者工具集</a><ul>
<li class="toctree-l2"><a class="reference internal" href="pickletools.html#command-line-usage">命令行语法</a><ul>
<li class="toctree-l3"><a class="reference internal" href="pickletools.html#command-line-options">命令行选项</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="pickletools.html#programmatic-interface">编程接口</a></li>
</ul>
</li>
</ul>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h4>上一个主题</h4>
  <p class="topless"><a href="importlib.html"
                        title="上一章"><code class="xref py py-mod docutils literal notranslate"><span class="pre">importlib</span></code> --- <code class="xref std std-keyword docutils literal notranslate"><span class="pre">import</span></code> 的实现</a></p>
  <h4>下一个主题</h4>
  <p class="topless"><a href="parser.html"
                        title="下一章"><code class="xref py py-mod docutils literal notranslate"><span class="pre">parser</span></code> --- 访问 Python 解析树</a></p>
  <div role="note" aria-label="source link">
    <h3>本页</h3>
    <ul class="this-page-menu">
      <li><a href="../bugs.html">提交 Bug</a></li>
      <li>
        <a href="https://github.com/python/cpython/blob/3.7/Doc/library/language.rst"
            rel="nofollow">显示源代码
        </a>
      </li>
    </ul>
  </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>  
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>导航</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="总目录"
             >索引</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python 模块索引"
             >模块</a> |</li>
        <li class="right" >
          <a href="parser.html" title="parser --- 访问 Python 解析树"
             >下一页</a> |</li>
        <li class="right" >
          <a href="importlib.html" title="importlib --- import 的实现"
             >上一页</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &#187;</li>
        <li>
          <a href="../index.html">3.7.8 Documentation</a> &#187;
        </li>

          <li class="nav-item nav-item-1"><a href="index.html" >Python 标准库</a> &#187;</li>
    <li class="right">
        

    <div class="inline-search" style="display: none" role="search">
        <form class="inline-search" action="../search.html" method="get">
          <input placeholder="快速搜索" type="text" name="q" />
          <input type="submit" value="转向" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
    <script type="text/javascript">$('.inline-search').show(0);</script>
         |
    </li>

      </ul>
    </div>  
    <div class="footer">
    &copy; <a href="../copyright.html">版权所有</a> 2001-2020, Python Software Foundation.
    <br />
    Python 软件基金会是一个非盈利组织。
    <a href="https://www.python.org/psf/donations/">请捐助。</a>
    <br />
    最后更新于 6月 29, 2020.
    <a href="../bugs.html">发现了问题</a>？
    <br />
    使用<a href="http://sphinx.pocoo.org/">Sphinx</a>2.3.1 创建。
    </div>

  </body>
</html>